﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraBars;

namespace Sunboxsoft.WinForm.Shell.Components
{
    public partial class MainContent : UserControl
    {
        public MainContent()
        {
            InitializeComponent();
        }

        public void RemoveAllView()
        {
            panel1.Controls.Clear();
        }

        public void AddView(object view)
        {
            panel1.Controls.Add((Control)view);
        }

        public void RemoveView(object view)
        {
            panel1.Controls.Remove((Control)view);
        }

        public object GetLastView()
        {
            if (panel1.Controls.Count > 0)
            {
                return panel1.Controls[panel1.Controls.Count - 1];
            }
            return null;
        }

        public void HideCurrentView()
        {
            if (panel1.Controls.Count > 0)
            {
                panel1.Controls[panel1.Controls.Count - 1].Visible = false;
            }
        }
        public void ShowCurrentView()
        {
            if (panel1.Controls.Count > 0)
            {
                panel1.Controls[panel1.Controls.Count - 1].Visible = true;
            }
        }

        #region actions
        public Bar GetToolbar()
        {
            return bar1;
        }

        public void AddAction(string text, Action<object, object> clickEventHandler)
        {
        }
        #endregion
    }
}
